/***************************************
 *File name: MainFace.c                *
 *Author: Gu Zhengxiong                *
 *Version: 2013.11.22.2                *
 *Description:The file implements      *
 *functions in MainFace.h.             *
 ***************************************/

# include <stdio.h>//For printf ().
# include <stdlib.h>//For system (), exit (), EXIT_FAILURE.

# include "MainFace.h"

void
SetCmdProperty (void)
{
	system ("cls");
	system ("color a");
}
void
ShowFace (void)
{
	SetCmdProperty ();
	printf ("                  * * * * * * * * * * * * * * * * * * * * *\n");//18 blanks
	printf ("                  * STUDENT INFO &GRADE MANAGEMENT SYSTEM *\n");//18 blanks
	printf ("                  * * * * * * * *           * * * * * * * *\n");//18 blanks
	printf ("                                * MAIN MENU *\n");
	printf ("                                * * * * * * *\n\n");
	printf ("      * * * * * * *             * * * * * * *             * * * * * * *\n");//6 blanks
	printf ("      * 1  LOAD   *             * 2   ADD   *             * 3  SEARCH *\n");
	printf ("      * * * * * * *             * * * * * * *             * * * * * * *\n\n");
	printf ("      * * * * * * *             * * * * * * *             * * * * * * *\n");
	printf ("      * 4  MODIFY *             * 5 DISPLAY *             * 6  SORT   *\n");
	printf ("      * * * * * * *             * * * * * * *             * * * * * * *\n\n");
	printf ("      * * * * * * *             * * * * * * *             * * * * * * *\n");
	printf ("      * 7  DELETE *             * 8  SAVE   *             * 9  QUIT   *\n");
	printf ("      * * * * * * *             * * * * * * *             * * * * * * *\n\n");
}
void
ShowError (int error_type)
{
	switch (error_type)
	{
	case IN_ERR: 
		{
			printf ("      INPUTS ERROR!\n      PRESS ENTER TO RETURN....");
			getchar ();
			getchar ();
		}
		break;
		case MAL_ERR: 
			{
				printf ("      MEMORY ALLOCATION FAILED!\n      PRESS ENTER TO QUIT....");
				getchar ();
				getchar ();
				exit (EXIT_FAILURE);
			}
			break;
		case UNFOUND:
			{
				printf ("      NOT FOUND!\n      PRESS ENTER TO RETURN....");
				getchar ();
				getchar ();
			}
			break;
		case NO_RECORD:
			{
				printf ("      THERE ARE NO RECORD NOW!\n      LOAD SOME OR ADD ONE.\n");
				printf ("      PRESS ENTER TO RETURN....");
				getchar ();
				getchar ();
			}
			break;
	}
}